﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
  <xsl:output method="xml" indent="yes" encoding="utf-8" media-type="text/xml" />
  <xsl:param name="relrootpath"/>
  <xsl:param name="eventname" />
  <xsl:param name="userid" />
  <xsl:param name="lastupdate" />

  <xsl:template match="/Context">
    <Transform>
      <xsl:apply-templates select="Events[@EventName=$eventname]">
      </xsl:apply-templates>
    </Transform>
  </xsl:template>

  <xsl:template match="Events[@EventName='ThreadCreated']">
    <Content>
      <div>
        <div class="datetext">
          <xsl:value-of select="$lastupdate"/>
        </div>
        <dl>
          <dt>
            <span class="nss ns-reply">
              <xsl:text> </xsl:text>
            </span>
            <span class="iconlabel">
            <control kind="userlink">
              <xsl:attribute name="UserId">
                <xsl:value-of select="$userid"/>
              </xsl:attribute>
            </control>
            <xsl:text>发表了新话题：</xsl:text>
            </span>
            <xsl:apply-templates select="Event" mode="ThreadCreated"/>
          </dt>
        </dl>
      </div>
    </Content>
  </xsl:template>

  <xsl:template match="Events/Event" mode="ThreadCreated">
    <dd>
      <a>
        <xsl:attribute name="href">
          <xsl:value-of select="$relrootpath"/>
          <xsl:text>/Mod/Talks/Thread.aspx?u=1&amp;t=</xsl:text>
          <xsl:value-of select="ThreadId"/>
        </xsl:attribute>
        <xsl:value-of select="Title" />
      </a>
    </dd>
  </xsl:template>

</xsl:stylesheet>
